<?php


namespace app\common\validate;


class XXXXXValidate extends CommonValidate
{
    protected $rule = [
        'id|ID'            => 'require|integer|between:1,100000000',
    ];

    protected $message = [];

    protected $scene = [
        'postXXXXX'   => ['', ''],
        'putXXXXX'    => ['id', '', ''],
        'deleteXXXXX' => ['id'],
    ];

    /**
     * @param $value
     * @return bool
     */
    protected function enumXXXXX($value): ?bool
    {
        try {
            if (false !== filter_var($value, FILTER_VALIDATE_INT)) {
                $rule = '1,1000000';
                if (is_string($rule)) {
                    $rule = explode(',', $rule);
                }
                [
                    $min,
                    $max,
                ] = $rule;

                return $value >= $min && $value <= $max;
            }
            if ($value === 'null') {
                return true;
            }
            return false;
        } catch (\Exception $e) {
            return false;
        }
    }
}